package com.hxc.common.Schedule;

import com.hxc.common.db.HanaDB;
import com.hxc.common.service.jobs.GitLabJob;
import java.sql.Connection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class GitLabUploadScheduleTasks {

  @Autowired
  HanaDB hanaDB;

  @Scheduled(fixedDelay = 1000 * 30)
  public void uploadGitLab() throws Exception {
    try (Connection conn = hanaDB.create()) {
      System.out.println("开始执行同步异常文档数据");
      new GitLabJob().uploadGitLabEHSOPTask(conn);
      System.out.println("结束执行同步异常文档数据");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
